#include "StdAfx.h"
#include "MainMenuPainter.h"

CMainMenuPainter::CMainMenuPainter():CContainerPainter()
{

}

void CMainMenuPainter::Paint(CDC* pDc, CContainer* pContainer, CRect& rc)
{
	int nCount = pContainer->m_vecControls.size();
	if(pContainer->GetBackGnd())
	{
		CDC dcTmp;
		dcTmp.CreateCompatibleDC(NULL);
		dcTmp.SelectBitmap(pContainer->GetBackGnd());
		pDc->BitBlt(0,0,pContainer->GetRect().Width(),pContainer->GetRect().Height(),dcTmp.m_hDC,0,0,SRCCOPY);
		dcTmp.DeleteDC();
	}
	else
	{
		pDc->FillSolidRect(rc,pContainer->GetBackColor());
	}

	for(int i=0; i < nCount; i++)
	{
		if ( pContainer->m_vecControls.at(i)->GetID() )
		{
			pContainer->m_vecControls.at(i)->Paint(pDc);
		}
	}
}